home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form Form1
- BackColor = &H00000000&
- Caption = "The VB Typewriter"
- ClientHeight = 3195
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 4680
- BeginProperty Font
- Name = "Fixedsys"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- LinkTopic = "Form1"
- ScaleHeight = 3195
- ScaleWidth = 4680
- StartUpPosition = 3 'Windows Default
- Attribute VB_Name = "Form1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- ' This is the typewriter object
- Dim myTyper As New Typer
- Dim curString As String
- Private Sub Form_Load()
- ' CurTime is the current time
- ' NextTime is when we should next execute
- Dim CurTime As Long, NextTime As Long
- ' Make sure we give VB time to show the form
- Me.Show
- ' Set the NextTime to the current time + 50ms
- NextTime = timeGetTime() + 50
- myTyper.Y = 12
- curString = "This is the VB TypeWriter....."
- ' Main loop
- Do While DoEvents()
- ' Get the current time
- CurTime = timeGetTime()
-
- ' If the current time is up to or past NextTime
- If CurTime >= NextTime Then
- ' Clear the form
- Me.Cls
-
- ' Do the call
- res = myTyper.Draw(Me.hDC, curString, RGB(0, 255, 0))
- If res = TW_STILLTYPING Then
- ' Set the next time the loop is executed
- If myTyper.CurCharNo > 25 Then
- NextTime = NextTime + 500
- Else
- NextTime = NextTime + 50
- End If
- ElseIf res = TW_DONETYPING Then
- NextTime = NextTime + 1000
- End If
- End If
-
- Loop
- End Sub
-